<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.longtop.com/intelliweb" prefix="e"%>
<%@ page isELIgnored="false"%>
<html>
	<head>
		<title>考核方案-第二步评分标准-SJH</title>
	</head>
<e:View id="eView" designProperty="width: 1024; height: 768">
	<script type="text/javascript">SkinUtil.getSkin();</script>
	<script type="text/javascript">SkinUtil.getModuleSkin();</script>	
	<script type="text/javascript" src="<c:url value='/js/perform/perform.js'/>"></script>
	
	<div id="Invisual Controls" style="min-height: 40px;" >
	<!-- 考核方案对应指标 -->
		<e:Dataset id="Dataset_project_index" datasetDefinition="DatasetDefinition_khyg.dsd" datasetRef="Dataset_Project_Index" pageSize="-1">
			<e:Field name="id" dataType="string" label="id" maxLength="32" />
			<e:Field name="projectId" dataType="string" label="考核方案ID" maxLength="32" />
			<e:Field name="indexId" dataType="string" label="指标ID" maxLength="32" />
			<e:Field name="baseScore" dataType="bigdecimal" label="基础分" maxLength="14" scale="2" />
			<e:Field name="scoreModeId" dataType="string" label="对应评分模型ID" maxLength="32" />
			<e:Field name="formula" dataType="string" label="评分公式" maxLength="4000" />
			<e:Field name="indexName" dataType="string" label="指标名称"/>
		</e:Dataset>
	<!-- 评分模型 -->
		<e:Dataset id="Dataset_scoreModel" datasetDefinition="DatasetDefinition_khyg.dsd" datasetRef="Dataset_ScoreModel" pageSize="-1">
			<e:Field name="scoreModeId" dataType="string" label="对应评分模型ID" maxLength="32" />
			<e:Field name="scoreModeName" dataType="string" label="对应评分模型名称" maxLength="100" />
			<e:Field name="formula" dataType="string" label="评分公式" maxLength="4000" />
			<e:Field name="isBaseScore" dataType="string" label="是否存在基础分" maxLength="1" />
			<e:Field name="scoreModeDesc" dataType="string" label="评分模型说明" maxLength="400" />
			<e:Field name="pagePath" dataType="string" label="评分模型对应的JSP名称" />
		</e:Dataset>	
		
	<!-- 指标ID对应名称 -->
		<e:DataDropDown id="DataDropDown_indexName" dataset="Dataset_project_index"
		      visibleFields="indexName" codeField="indexId" textField="indexName" showColumnHeader="false" fixed="true"
		      onAfterSelect="DataDropDown_indexName_onAfterSelect()">
		</e:DataDropDown>
	<!-- 评分模型ID对应名称 -->
		<e:DataDropDown id="DataDropDown_scoreName" dataset="Dataset_scoreModel"
		      visibleFields="scoreModeName" codeField="scoreModeId" textField="scoreModeName" showColumnHeader="false" fixed="true"
		      addedItemLabel="==请选择==" addedItemValue="0" showAddedItem="true" writeFields="scoreModeId"
		      onAfterSelect="DataDropDown_scoreName_onAfterSelect()">
		</e:DataDropDown>
	</div>
	
<body style="overflow: auto">
<e:Page id="ePage" action="com.longtop.perform.kh.score.web.ScoreMainAction" onAfterLoadPage="ePage_onAfterLoadPage()">
	<table width="100%" height="100%" border="0" align="center" cellpadding="2" cellspacing="2">
		 <tr>
			<td align="left" valign="top">
					<table width="100%">
						<tr>
							<td valign="top" align="left">
								<e:GroupBox id="GroupBox" style="width: 100%; " caption="考核方案">
									<table style="text-align: left; width: 100%;" border="0" cellpadding="2" cellspacing="2" align="center">
										<tr id="tr01">
											<td align="right" nowrap="nowrap">&nbsp;&nbsp;</td>
											<td align="right" nowrap="nowrap"><e:Label id="Label_projectName" caption="考核方案"/></td>
											<td align="left">
												<e:Text id="Text_projectName" style="width:250px" readOnly="true"/>
											</td>									
											<td align="right" nowrap="nowrap"><e:Label id="Label_indexName" caption="考评指标"/></td>
											<td align="left" width="99%">
												<e:Text id="Text_indexName" style="width:250px" dropDown="DataDropDown_indexName"/>
											</td>
										</tr>
									</table>
								</e:GroupBox>
							</td>
						</tr>
						<tr>
							<td valign="top" align="left">
								<e:GroupBox id="GroupBox_list" style="width: 100%;height:100%" caption="评分模型列表">
									<table style="width: 500px;" border="0">
										<tbody>
											<tr id="trMod" style="display: none">
					    						<td class="fonttitle" width="100" align="right">
					    							<font color="red">*</font>评分模型
					    						</td>
					    						<td>
					    							<e:Text id="Text_score" dataset="Dataset_project_index" field="scoreModeId" dropDown="DataDropDown_scoreName"/>
					    						</td>
												<td class="fonttitle" colspan="2">
													<div id="baseScoreDiv">
														<font color="red">*</font>分值
						    							<e:Text id="Text_baseScore" dataset="Dataset_project_index" field="baseScore" style="width:70px;"/>
						    						</div>
					    						</td>
											</tr>
										</tbody>
									</table>
									<table style="text-align: left; width: 100%;" border="0">
										<tbody>
											<tr>
												<td style="width:100%;height:100%">
													<!-- 评分模型页面： -->
													<iframe style="width: 99%; height: 290px" id="IframePage" src="" frameborder="0"></iframe>
		                						</td>
	                						</tr>
										</tbody>
									</table>
								</e:GroupBox>
							</td>
						</tr>
					<table>
			</td>
		</tr>
	</table>
<script type="text/javascript">
	var projectId = '${param.projectId}';
	//init：
	function ePage_onAfterLoadPage() {
		$J("Text_projectName").setValue(parent.$J("Text_projectName").getValue());//显示方案名称
	}
	//选择指标：
	function DataDropDown_indexName_onAfterSelect(dropdown,record,text){
		var trMod = document.getElementById("trMod");
		trMod.style.display = 'block';
		
		var scoreModeId = Dataset_project_index.getValue("scoreModeId");
		//指标对应-设置评分模型ds选中到相应的记录：【*】
		Dataset_scoreModel.setRecord(Dataset_scoreModel.locate(["scoreModeId"],[scoreModeId],Constant.OPERATOR.EQUAL));
		showbaseScoreTxt();//是否显示分值
	    //-跳转评分模型页面:
	    if(isEmpty(scoreModeId) || scoreModeId=='0'){
			IframePage.navigate(__CONTEXT_PATH +"jsp/perform/kh/score/failure.jsp");
		}else{
			var page = Dataset_scoreModel.getValue("pagePath");
			IframePage.navigate(__CONTEXT_PATH +"jsp/perform/kh/score/"+page);
		}
	}
	//选择评分模型：
	function DataDropDown_scoreName_onAfterSelect(){
		var scoreModeId = Dataset_scoreModel.getValue("scoreModeId");
		Dataset_project_index.setValue("scoreModeId",scoreModeId);
		showbaseScoreTxt();//是否显示分值
	    //-跳转评分模型页面:
	    if(isEmpty(scoreModeId) || scoreModeId=='0'){
			IframePage.navigate(__CONTEXT_PATH +"jsp/perform/kh/score/failure.jsp");
		}else{
			var page = Dataset_scoreModel.getValue("pagePath");
			//var path = page+"?projectId="+projectId+"&indexId="+indexId+"&scoreModeId="+scoreModeId+"&baseScore="+baseScore;
			IframePage.navigate(__CONTEXT_PATH +"jsp/perform/kh/score/"+page);
		}
	
	}
	//是否显示分值
	function showbaseScoreTxt(){
		$J("Text_score").render();
		$J("Text_baseScore").setValue("");
		var baseScore = Dataset_scoreModel.getValue("isBaseScore");
		if(baseScore == '0'){
			document.getElementById("baseScoreDiv").style.display = 'none';
		}else{
			document.getElementById("baseScoreDiv").style.display = 'block';
		}
	}

</script>

</e:Page>
</body>
</e:View>
</html>